package com.war.dao.system;

import com.war.pojo.system.Customer;
import com.war.pojo.system.Supplier;
import com.war.pojo.system.Warehouse;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CustomerDao {
    //查询顾客
    @Select("select * from sys_customer")
    List<Customer> selectAll();

    //查询顾客名称
    @Select("select name from sys_customer")
    List<Customer> selectName();

    //根据顾客名查顾客
    @Select("select * from sys_customer where name=#{name}")
    Customer selectByName(Customer customer);

    //根据id查顾客
    @Select("select * from sys_customer where id=#{id}")
    Customer selectById(Customer Customer);

    //根据法人代表查供应商
    @Select("select * from sys_customer where legal_person=#{legal_person}")
    Customer selectByLP(Customer Customer);

    //删除顾客
    @Delete("delete from sys_customer where id=#{id}")
    int delCus(Customer customer);

    //修改顾客信息
    @Update("update sys_supplier set id=#{id}, name=#{name}, legal_person=#{legal_person}, tel=#{tel}, email=#{email} address=#{address}, begin_cooperation=#{begin_cooperation}, cooperation_years=#{cooperation_years} where id=#{id}")
    int updateCus(Customer customer);

    //注册顾客
    @Insert("insert into sys_supplier(id, name, legal_person, tel, email, address, begin_cooperation, cooperation_years) value(#{id}, #{name}, #{legal_person}, #{tel}, #{email}, #{address}, #{begin_cooperation}, #{cooperation_years})")
    int addCus(Customer customer);

}
